Repository navigation
Move attendees from transaction to transaction's comment - #58120
Conversation
|
Hey @allroundexperts, I'm looking into the issues you mentioned here. 1) the call to UpdateMoneyRequestAttendees results in a response that sends old and new attendees in the originalMessage as object instead of string Sending an array of objects for new and existing attendee sounds correct to me, is the client expecting this in string form?
2) the backend is not sending the accountId and the login key for the transaction.comment.attendees I believe our attendee object is expected, because that's exactly how we store attendees on the backend. Massaging them wouldn't be ideal. Would it be sufficient to return them in the personal details onyxData? |
|
it sounds like you're using the original message for the report comment, which might not be correct.
Or instead, lets ensure that |
I looked further into this issue and I think you can use this existing attendees function that converts the array of attendee objects to a string: So we'd call that function here, passing in the message string we just converted. |
|
@Julesssss Fixed the first error. Screen.Recording.2025-03-28.at.2.01.23.AM.mov |
fedirjh
left a comment
There was a problem hiding this comment.
Left some code changes that should fix the problem with hidden items :
Full code diff
diff --git a/src/pages/iou/request/MoneyRequestAttendeeSelector.tsx b/src/pages/iou/request/MoneyRequestAttendeeSelector.tsx
index 3098fd1ef15..ebbe50c889b 100644
--- a/src/pages/iou/request/MoneyRequestAttendeeSelector.tsx
+++ b/src/pages/iou/request/MoneyRequestAttendeeSelector.tsx
@@ -11,6 +11,7 @@ import {useOptionsList} from '@components/OptionListContextProvider';
import SelectionList from '@components/SelectionList';
import InviteMemberListItem from '@components/SelectionList/InviteMemberListItem';
import type {SectionListDataType} from '@components/SelectionList/types';
+import type {Option} from '@libs/OptionsListUtils';
import useDebouncedState from '@hooks/useDebouncedState';
import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
@@ -31,6 +32,7 @@ import {
orderOptions,
} from '@libs/OptionsListUtils';
import {isPaidGroupPolicy as isPaidGroupPolicyFn} from '@libs/PolicyUtils';
+import {getPersonalDetailByEmail} from '@libs/PersonalDetailsUtils';
import {searchInServer} from '@userActions/Report';
import type {IOUAction, IOUType} from '@src/CONST';
import CONST from '@src/CONST';
@@ -148,7 +150,7 @@ function MoneyRequestAttendeeSelector({attendees = [], onFinish, onAttendeesAdde
* Returns the sections needed for the OptionsSelector
*/
const [sections, header] = useMemo(() => {
- const newSections: Array<SectionListDataType<Attendee>> = [];
+ const newSections: Array<SectionListDataType<Option>> = [];
if (!areOptionsInitialized || !didScreenTransitionEnd) {
return [newSections, ''];
}
@@ -158,23 +160,28 @@ function MoneyRequestAttendeeSelector({attendees = [], onFinish, onAttendeesAdde
const formatResults = formatSectionsFromSearchTerm(
debouncedSearchTerm,
- attendees.map((attendee) => ({...attendee, reportID: attendee.reportID ?? CONST.DEFAULT_NUMBER_ID.toString()})),
+ attendees.map((attendee) => ({
+ ...attendee,
+ reportID: attendee.reportID ?? CONST.DEFAULT_NUMBER_ID.toString(),
+ selected: true,
+ ...getPersonalDetailByEmail(attendee.email)
+ })),
chatOptions.recentReports,
chatOptions.personalDetails,
personalDetails,
true,
);
- newSections.push(formatResults.section as SectionListDataType<Attendee>);
+ newSections.push(formatResults.section);
newSections.push({
title: translate('common.recents'),
- data: fiveRecents as Attendee[],
+ data: fiveRecents,
shouldShow: fiveRecents.length > 0,
});
newSections.push({
title: translate('common.contacts'),
- data: contactsWithRestOfRecents as Attendee[],
+ data: contactsWithRestOfRecents,
shouldShow: contactsWithRestOfRecents.length > 0,
});
@@ -187,7 +194,7 @@ function MoneyRequestAttendeeSelector({attendees = [], onFinish, onAttendeesAdde
data: [chatOptions.userToInvite].map((participant) => {
const isPolicyExpenseChat = participant?.isPolicyExpenseChat ?? false;
return isPolicyExpenseChat ? getPolicyExpenseReportOption(participant) : getParticipantsOption(participant, personalDetails);
- }) as Attendee[],
+ }),
shouldShow: true,
});
}
@@ -214,12 +221,16 @@ function MoneyRequestAttendeeSelector({attendees = [], onFinish, onAttendeesAdde
]);
const addAttendeeToSelection = useCallback(
- (option: Attendee) => {
+ (option: Option) => {
const isOptionSelected = (selectedOption: Attendee) => {
if (selectedOption.accountID && selectedOption.accountID === option?.accountID) {
return true;
}
+ if (selectedOption.email && selectedOption.email === option?.login) {
+ return true;
+ }
+
return false;
};
const isOptionInList = attendees.some(isOptionSelected);
@@ -239,7 +250,7 @@ function MoneyRequestAttendeeSelector({attendees = [], onFinish, onAttendeesAdde
displayName: option.text ?? '',
selected: true,
searchText: option.searchText,
- avatarUrl: option.avatarUrl ?? '',
+ avatarUrl: option.avatarUrl ?? option.icons?.[0]?.source?.toString() ?? '',
iouType,
},
];
@@ -253,7 +264,7 @@ function MoneyRequestAttendeeSelector({attendees = [], onFinish, onAttendeesAdde
const shouldShowErrorMessage = attendees.length < 1;
const handleConfirmSelection = useCallback(
- (_keyEvent?: GestureResponderEvent | KeyboardEvent, option?: Attendee) => {
+ (_keyEvent?: GestureResponderEvent | KeyboardEvent, option?: Option) => {
if (shouldShowErrorMessage || (!attendees.length && !option)) {
return;
}
Co-authored-by: Fedi Rajhi <fedirjh@gmail.com>
This is handled @francoisl |
fedirjh
left a comment
There was a problem hiding this comment.
There is a little bug with paid workspace, when you select the current user and you try to edit later, the current user will be displayed twice in the list :
This code should fix it:
diff --git a/src/pages/iou/request/MoneyRequestAttendeeSelector.tsx b/src/pages/iou/request/MoneyRequestAttendeeSelector.tsx
index a374e460ccc..78804d1800c 100644
--- a/src/pages/iou/request/MoneyRequestAttendeeSelector.tsx
+++ b/src/pages/iou/request/MoneyRequestAttendeeSelector.tsx
@@ -66,7 +66,7 @@ function MoneyRequestAttendeeSelector({attendees = [], onFinish, onAttendeesAdde
const [betas] = useOnyx(ONYXKEYS.BETAS);
const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID);
const session = useSession();
- const isCurrentUserAttendee = attendees.some((attendee) => attendee.accountID === session?.accountID);
+ const isCurrentUserAttendee = attendees.some((attendee) => attendee.email === session?.email);
const [recentAttendees] = useOnyx(ONYXKEYS.NVP_RECENT_ATTENDEES);
const policy = usePolicy(activePolicyID);
const [isSearchingForReports] = useOnyx(ONYXKEYS.IS_SEARCHING_FOR_REPORTS, {initWithStoredValues: false});
francoisl
left a comment
There was a problem hiding this comment.
This should fix the "changed the attendees X, Y (previously Z)" action messages after signing back in, can you give it a try?
Those are built off of the |
Co-authored-by: Francois Laithier <francois@expensify.com>
Applied and it works! |
Reviewer Checklist
|
Screenshots/VideosAndroid: NativeCleanShot.2025-04-01.at.18.52.28.mp4Android: mWeb ChromeCleanShot.2025-04-01.at.18.25.39.mp4iOS: NativeCleanShot.2025-04-01.at.18.03.40.mp4iOS: mWeb SafariCleanShot.2025-04-01.at.18.09.37.mp4MacOS: Chrome / SafariCleanShot.2025-04-01.at.17.37.38.mp4MacOS: DesktopCleanShot.2025-04-01.at.18.56.59.mp4 |
| // return false; | ||
| // To be renabled once feature is complete: https://github.com/Expensify/App/issues/44725 | ||
| // Keep this disabled for per diem expense | ||
| // return iouType === CONST.IOU.TYPE.SUBMIT && !!policy?.id && (policy?.type === CONST.POLICY.TYPE.CORPORATE || policy?.type === CONST.POLICY.TYPE.TEAM); | ||
| return iouType === CONST.IOU.TYPE.SUBMIT && !!policy?.id && (policy?.type === CONST.POLICY.TYPE.CORPORATE || policy?.type === CONST.POLICY.TYPE.TEAM); |
There was a problem hiding this comment.
Should we return false here before we merge it?
There was a problem hiding this comment.
Nah, the rest is ready so let's go ahead and release this to everyone. We'd just need to clean up the commented code here, though I'm not going to block on this so we can get this deployed asap, and I'll clean up the commented code once this is on production.
| // return false; | ||
| // To be renabled once feature is complete: https://github.com/Expensify/App/issues/44725 | ||
| // Keep this disabled for per diem expense | ||
| // return iouType === CONST.IOU.TYPE.SUBMIT && !!policy?.id && (policy?.type === CONST.POLICY.TYPE.CORPORATE || policy?.type === CONST.POLICY.TYPE.TEAM); | ||
| return iouType === CONST.IOU.TYPE.SUBMIT && !!policy?.id && (policy?.type === CONST.POLICY.TYPE.CORPORATE || policy?.type === CONST.POLICY.TYPE.TEAM); |
There was a problem hiding this comment.
Nah, the rest is ready so let's go ahead and release this to everyone. We'd just need to clean up the commented code here, though I'm not going to block on this so we can get this deployed asap, and I'll clean up the commented code once this is on production.
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/francoisl in version: 9.1.23-1 🚀
|
| // To be renabled once feature is complete: https://github.com/Expensify/App/issues/44725 | ||
| // Keep this disabled for per diem expense | ||
| // return iouType === CONST.IOU.TYPE.SUBMIT && !!policy?.id && (policy?.type === CONST.POLICY.TYPE.CORPORATE || policy?.type === CONST.POLICY.TYPE.TEAM); | ||
| return iouType === CONST.IOU.TYPE.SUBMIT && !!policy?.id && (policy?.type === CONST.POLICY.TYPE.CORPORATE || policy?.type === CONST.POLICY.TYPE.TEAM); |
There was a problem hiding this comment.
Not having invoice type check here seemed to have created this bug #59602
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.1.23-7 🚀
|
|
This issue is probably caused by the changes introduced in the PR. |



Explanation of Change
Move
attendeesfrom transaction to transaction's commentFixed Issues
$ #57717
PROPOSAL: N/A
Tests
Attendeessection and add some attendee users.Verify that the attendees show up on the expense details page.
Attendeessection and add more attendees.Verify that the attendees get added successfully and a message appears in the expense details page showing the previous and new attendees.
Offline tests
Same as tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionQA stepssectiontoggleReportand notonIconClick).src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarhave been tested & I retested again)/** comment above it */thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
Screen.Recording.2025-03-19.at.12.53.16.AM.mov
Screen.Recording.2025-03-28.at.4.26.19.AM.mov
iOS: Native
Screen.Recording.2025-03-19.at.1.16.52.AM.mov
Screen.Recording.2025-03-28.at.4.24.29.AM.mov
iOS: mWeb Safari
Screen.Recording.2025-03-19.at.1.08.35.AM.mov
Screen.Recording.2025-03-28.at.3.59.55.AM.mov
MacOS: Chrome / Safari
Screen.Recording.2025-03-18.at.11.49.41.AM.mov
Screen.Recording.2025-03-28.at.3.52.14.AM.mov
MacOS: Desktop
Screen.Recording.2025-03-18.at.11.59.34.AM.mov
Screen.Recording.2025-03-28.at.3.56.33.AM.mov